<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单字段(fname)的值为空required属性会阻止表单提交</title>
</head>

<body>
    <form action="demo_form.php" method="post">
        <input type="text" name="fname" required="required">
        <input type="submit" value="提交">
    </form>
    <p>点击提交按钮，如果输入框是空的，浏览器会提示错误信息。</p>
</body>

</html>